﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SmallShop.Services.Code
{
    public class ConvertDay
    {
        private int days;
        public int Day { get; set; }
        public int Month { get; set; }
        public int Year { get; set; }
        public ConvertDay(int day)
        {
            days = day;
            if (days < 30)
            {
                OnlyDay();
            }
            else if (days < 360)
            {
                IncludeMonth();
            }
            else if (days >= 360)
            {
                FullYear();
            }
            else
            {
                Day = 0;
                Month = 0;
                Year = 0;
            }
        }
        public void OnlyDay()
        {
            Day = days;
            Month = 0;
            Year = 0;
        }
        public void IncludeMonth()
        {
            var temp = days % 30;
            Month = (days - temp) / 30;
            Day = temp;
        }
        public void FullYear()
        {
            var temp = days % 360;
            Year = (days - temp) / 360;
            var temp2 = temp % 30;
            Month = (temp - temp2) / 30;
            Day = temp2;
        }
    }
}
